package org.iabako.server.mail;

import org.iabako.server.mail.template.IabakoMailTemplate;
import org.iabako.shared.entity.user.Enterprise;
import org.springframework.core.io.InputStreamSource;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by jose on 31/01/15.
 */
public class IabakoMailHelper implements Serializable {

    private List<String> to = new ArrayList<String>();
    private String from;
    private String fromPersonal;
    private String subject;
    private String body;
    private IabakoMailTemplate template;

    private Enterprise enterprise;

    private Map<String, InputStreamSource> attachments = new LinkedHashMap<String, InputStreamSource>();

    private boolean disableDefaultFooter;
    private boolean disableIabakoLogo;
    private boolean addEnterpriseLogo;
    private boolean enablePoweredByFooter;
    private boolean noReplyEmail;

    public IabakoMailHelper(String from, String fromPersonal, String to, String subject, String body) {
        this.to.add(to);
        this.from = from;
        this.fromPersonal = fromPersonal;
        this.subject = subject;
        this.body = body;
    }

    public IabakoMailHelper(String from, String fromPersonal, List<String> to, String subject, String body) {
        this.to = to;
        this.from = from;
        this.fromPersonal = fromPersonal;
        this.subject = subject;
        this.body = body;
    }

    public List<String> getTo() {
        return to;
    }

    public void setTo(List<String> to) {
        this.to = to;
    }

    public String getFrom() {
        return from;
    }

    public void setFrom(String from) {
        this.from = from;
    }

    public String getFromPersonal() {
        return fromPersonal;
    }

    public void setFromPersonal(String fromPersonal) {
        this.fromPersonal = fromPersonal;
    }

    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public String getBody() {
        return template != null ? template.getTextBody() : body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public IabakoMailTemplate getTemplate() {
        return template;
    }

    public void setTemplate(IabakoMailTemplate template) {
        this.template = template;
    }

    public Map<String, InputStreamSource> getAttachments() {
        return attachments;
    }

    public void setAttachments(Map<String, InputStreamSource> attachments) {
        this.attachments = attachments;
    }

    public boolean getDisableDefaultFooter() {
        return disableDefaultFooter;
    }

    public void setDisableDefaultFooter(boolean disableDefaultFooter) {
        this.disableDefaultFooter = disableDefaultFooter;
    }

    public boolean isDisableIabakoLogo() {
        return disableIabakoLogo;
    }

    public void setDisableIabakoLogo(boolean disableIabakoLogo) {
        this.disableIabakoLogo = disableIabakoLogo;
    }

    public boolean isAddEnterpriseLogo() {
        return addEnterpriseLogo;
    }

    public void setAddEnterpriseLogo(boolean addEnterpriseLogo) {
        this.addEnterpriseLogo = addEnterpriseLogo;
    }

    public boolean isEnablePoweredByFooter() {
        return enablePoweredByFooter;
    }

    public void setEnablePoweredByFooter(boolean enablePoweredByFooter) {
        this.enablePoweredByFooter = enablePoweredByFooter;
    }

    public boolean isNoReplyEmail() {
        return noReplyEmail;
    }

    public void setNoReplyEmail(boolean noReplyEmail) {
        this.noReplyEmail = noReplyEmail;
    }

    public Enterprise getEnterprise() {
        return enterprise;
    }

    public void setEnterprise(Enterprise enterprise) {
        this.enterprise = enterprise;
    }
}
